package com.shaw.client.mvc;

import com.extjs.gxt.ui.client.Registry;
import com.extjs.gxt.ui.client.mvc.AppEvent;
import com.extjs.gxt.ui.client.mvc.Controller;
import com.extjs.gxt.ui.client.mvc.View;
import com.google.gwt.user.client.ui.RootPanel;

import com.shaw.client.model.ui.AppMainUI;
import com.shaw.client.mvc.widgt.LoginDialog;




public class AppView extends View {
	private AppMainUI desktop;
	public static String DESKTOP = "desktop";



	public AppView(Controller controller) {
		super(controller);
		// TODO Auto-generated constructor stub
	}

	@Override
	protected void handleEvent(AppEvent event) {
		// TODO Auto-generated method stub
		if (AppEvents.INIT == event.getType()) {

			initUI();

		} else if (AppEvents.LOGIN == event.getType())
		{
			new LoginDialog().show();
			
		}
			

	}

	private void initUI() {
		// TODO Auto-generated method stub
		//MessageBox wait = MessageBox.wait(null, "登录成功", "正在初始化");
	
		RootPanel.get().add(desktop);
		    
		    // registry serves as a global context
		  
		    
		//wait.close();
	}

	
	protected void initialize() {
		desktop = new AppMainUI();
	
		Registry.register(DESKTOP, desktop);


		
	}
	
	
}